#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>

using namespace std;

int main()
{
	string s;
	char ch;
	cin >> s >> ch;
	for (int i = 0; s[i]; i++)
	{
		if (s[i] == ch)
		{
			s[i] = '#';
		}
	}
	cout << s;
	return 0;
}